import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';

import {HomeComponent} from './home/home.component';
import {StartComponent} from "./home/index/class/start/start.component";
import {RollInfoComponent} from "./home/index/class/roll-info/roll-info.component";
import {RollClassComponent} from "./home/index/class/roll-info/roll-class/roll-class.component";
import {RollNoticeComponent} from "./home/index/class/roll-info/roll-notice/roll-notice.component";
import {RollSettingComponent} from "./home/index/class/roll-info/roll-setting/roll-setting.component";
import {AddNoticeComponent} from "./home/index/class/roll-info/add-notice/add-notice.component";
import {EnterGuard} from "./my-guard/enter.guard";
import {IndexComponent} from "./home/index/index.component";
import {ClassComponent} from "./home/index/class/class.component";
import {EnterComponent} from "./home/index/enter/enter.component";
import {SwotComponent} from "./home/index/swot/swot.component";
import {listComponent} from "./home/index/swot/list/list.component";
import {timelistComponent} from "./home/index/swot/list/timelist.component";
import {explainComponent} from "./home/index/swot/explain/explain.component";
import {canvasComponent} from "./home/index/swot/canvas/canvas.component";
import {canvaslistComponent} from "./home/index/swot/canvaslist/canvaslist.component";
import {classtotimelineComponent} from "./home/index/swot/classtotimeline/classtotimeline.component";

export const routes: Routes = [
  //首页
  {
    path: 'home', component: HomeComponent, data: {menu: 'home'}, canActivate: [EnterGuard],
    children: [
      {
        path: 'index', component: IndexComponent,
        children: [
          {
            path: 'class', component: ClassComponent, children: [
                {path:'start',component:StartComponent},
                {path:'',redirectTo: 'start',pathMatch: 'full'},
                {
                  path: 'info/:id', component: RollInfoComponent, children: [
                    {
                      path: '', component: RollClassComponent
                    },
                    {
                      path: 'notice/:id', component: RollNoticeComponent
                    },
                    {
                      path: 'setting', component: RollSettingComponent
                    },
                    {
                      path: 'add', component: AddNoticeComponent
                    }
                  ],
                },

              ],
          },
          {
            path:'swot',component:SwotComponent,children:[
              { path: 'list', component: listComponent, data: { menu: 'home', submenu: 'list' }},
              { path: 'timelist', component: timelistComponent, data: { menu: 'home', submenu: 'timelist' }},
              { path: 'explain', component: explainComponent, data: { menu: 'home', submenu: 'explain' }},
              {path: 'canvaslist/:FK_TrainningGuid', component: canvaslistComponent, data: { menu: 'canvaslist' }},
              {path: 'detail/:FK_ClassGuid', component: classtotimelineComponent, data: { menu: 'detail' }},
              { path: '', redirectTo: 'list', pathMatch: 'full' }
            ]
          }
        ]
      },
      {path:'enter',component:EnterComponent},
      {path: '', redirectTo: 'enter', pathMatch: 'full'},
    ]
  },
  {path: 'canvas/start/:CanvasGroupGuid', component: canvasComponent},
  {path: '', redirectTo: 'home', pathMatch: 'full'}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
  providers: [
    EnterGuard
  ]
})
export class AppRoutingModule {
}
